import { createRouter, createWebHistory } from 'vue-router'
import Login from "@/components/login/Login.vue";
import Home from "@/components/index/Home.vue";
import Register from "@/components/register/Register.vue";
import Centre from "@/components/index/Centre.vue";
import MDEditor from "@/components/articleExample/MDEdit.vue";
import User from "@/components/login/User.vue";
import AddArticle from "@/components/articleDetil/AddArticle.vue";
import MyArticle from "@/components/articleDetil/MyArticle.vue";
import ArticleCollect from "@/components/articleDetil/ArticleCollect.vue";
import FeedBack from "@/components/FeedBack.vue";
import Notice from "@/components/notice/Notice.vue";
import Ai from "@/components/text/Ai.vue";

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path:'/',
      name:'home',
      component:Home,
      children:[
        {
          path:'/',
          name:'centre',
          component:Centre
        },

        {
          path:"/userInfo",
          name:"userInfo",
          component:User
        },
        {
          path:"/addArticle/:id?",
          name:"addArticle",
          component:AddArticle,
          props(route){
            return route.params
          }
        },
        {
          path:"/myArticle",
          name:"myArticle",
          component:MyArticle
        },
        {
          path:"/articleCollect",
          name:"articleCollect",
          component:ArticleCollect
        },
        {
          path:"/feedBack",
          name:"feedBack",
          component:FeedBack
        },
        {
          path:"/notice",
          name:"notice",
          component:Notice
        },
      ]
    },
    {
      path:'/login',
      name:'login',
      component:Login
    },
    {
      path:'/register',
      name:'register',
      component:Register
    },
    {
      path:'/articleExample/:articleId',
      name:'MDEditor',
      component:MDEditor,
      props(route){
        return route.params
      }
    },
    {
      path:'/AI',
      name:'AI',
      component:Ai,
    },

  ]
})

export default router
